<?php
class Application_Model_Filter_GeneralizeGiftSearch {
    /**
     * 快速搜索
     */
    public $quick;  
    /**
     * id
     */
    public $id;
     /**
     * 开始时间
     */
    public $startTime;
    /**
     * 结束时间
     */
    public $endTime;
    /**
     * 类型
     */
    public $type;
    /**
     * 添加人
     */
    public $operator;
    
    function getSearchFileds() {
        $where=array(); 
        $and = "";
        if($this->quick != ""){
            $where["( name like "] = "%".  $this->quick . "%";
            $where[" or content like "] = "%".  $this->quick . "%";
            $where[" ) and 1 = "] = 1;
            $and = " and ";
        }
        if($this->id != ""){
            $where[$and." id = "] = $this->id;
            $and = " and ";
        }
        if($this->startTime != ""){
            $where[$and." dateCreated > "] = $this->startTime;
            $and = " and ";
        }
        
        if($this->endTime != ""){
            $where[$and." dateCreated <= "] = $this->endTime." 23:59:59";
            $and = " and ";
        }
        
        if($this->type != ""){
            $where[$and." type = "] = $this->type;
            $and = " and ";
        }
        
        if($this->operator != ""){
            $where[$and." operator = "] = $this->operator;
            $and = " and ";
        }
        
        return $where;
    }
    
}

